﻿<%@ Page Title="" Language="C#" MasterPageFile="~/UsersMaster.master" AutoEventWireup="true"
    CodeBehind="NewBuyingOrder.aspx.cs" Inherits="SMS.Orders.NewBuyingOrder" %>

<asp:Content ID="Content1" ContentPlaceHolderID="UserMainContent" runat="server">
    <table align="right" width="100%">
        <tr>
            <td>
                <asp:ValidationSummary runat="server" ValidationGroup="OrderVG" />
            </td>
        </tr>
        <tr>
            <td width="30%">
                <asp:DropDownList runat="server" ID="ddlStocks" Width="50%" />
            </td>
            <td>
                <asp:Label Text=": مـحـل" runat="server" AssociatedControlID="ddlStocks" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:TextBox runat="server" ID="txtCustomer" />
                <%--<ajax:AutoCompleteExtender runat="server" TargetControlID="txtCustomer" MinimumPrefixLength="1"
                    EnableCaching="true" ServiceMethod="" ServicePath="" />--%>
                <asp:RequiredFieldValidator runat="server" ControlToValidate="txtCustomer" ValidationGroup="OrderVG"
                    ErrorMessage="أدخــل أسـم العـمـيل">*</asp:RequiredFieldValidator>
            </td>
            <td>
                <asp:Label runat="server" AssociatedControlID="txtCustomer" Text=": العميــل" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:TextBox runat="server" ID="txtBarCode" AutoPostBack="true" OnTextChanged="txtBarCode_TextChanged" />
            </td>
            <td>
                <asp:Label Text=": البـار كــود :" runat="server" AssociatedControlID="txtBarCode" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:TextBox runat="server" ID="txtItemName" />
            </td>
            <td>
                <asp:Label Text=": أســم" runat="server" AssociatedControlID="txtItemName" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:TextBox runat="server" ID="txtMark" AutoPostBack="true" OnTextChanged="txtMark_TextChanged" />
            </td>
            <td>
                <asp:Label Text=": المــاركـة" runat="server" AssociatedControlID="txtMark" />
            </td>
        </tr>
    </table>
    <%--<tr>
            <td colspan="2">--%>
    <p>
        <asp:DataList ID="dlStockItems" runat="server" BorderWidth="1" EditItemIndex="-1"
            DataKeyField="ID" OnEditCommand="dlStockItems_EditCommand" OnItemCommand="dlStockItems_ItemCommand"
            OnCancelCommand="dlStockItems_CancelCommand" OnUpdateCommand="dlStockItems_UpdateCommand"
            OnItemDataBound="dlStockItems_ItemDataBound" OnDeleteCommand="dlStockItems_DeleteCommand">
            <HeaderTemplate>
                <table border="1" align="right" >
                    <tr align="center">
                        <td>
                            <asp:Label runat="server" Text="حـذف" Font-Bold="true" />
                        </td>
                        <td>
                            <asp:Label runat="server" Text="تعـديـل" Font-Bold="true" />
                        </td>
                        <td>
                            <asp:Label runat="server" Text="أسـم المنـتـج" Font-Bold="true" />
                        </td>
                        <td>
                            <asp:Label runat="server" Text="المــاركـة" Font-Bold="true" />
                        </td>
                        <td>
                            <asp:Label ID="Label2" runat="server" Text="العدد في المخـزن" Font-Bold="true" />
                        </td>
                        <td>
                            <asp:Label runat="server" Text="الكـمـيـة" Font-Bold="true" />
                        </td>
                        <td>
                            <asp:Label runat="server" Text="سـعـر الوحـدة" Font-Bold="true" />
                        </td>
                        <td>
                            <asp:Label runat="server" Text="الاجمــالي" Font-Bold="true" />
                        </td>
                    </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr align="center">
                    <td>
                        <asp:LinkButton runat="server" CommandName="delete" Text="حـذف" ID="lbDelete" />
                    </td>
                    <td>
                        <asp:LinkButton runat="server" CommandName="edit" Text="تعـديـل" ID="lbEdite" />
                    </td>
                    <td>
                        <asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"StockItem.Item.Name") %>' />
                    </td>
                    <td>
                        <asp:Label runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.StockItem.Item.Mark") %>' />
                    </td>
                    <td>
                        <asp:Label runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.StockItem.Count") %>' />
                    </td>
                    <td>
                        <asp:Label runat="server" Text='<%#DataBinder.Eval(Container,"DataItem.ItemCount") %>'
                            ID="lblQuantity" />
                    </td>
                    <td>
                        <asp:Label runat="server" ID="lblSellingPrice" Text='<%# DataBinder.Eval(Container,"DataItem.UnitPrice") %>' />
                    </td>
                    <td>
                        <asp:Label runat="server" ID="lblItemTotal" />
                    </td>
                </tr>
            </ItemTemplate>
            <EditItemTemplate>
                <tr align="center">
                    <td>
                        <asp:LinkButton runat="server" Text="مـوافق" CommandName="update" />
                    </td>
                    <td>
                        <asp:LinkButton runat="server" Text="الغـاء" CommandName="cancel" />
                    </td>
                    <td>
                        <asp:Label runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.StockItem.Item.Name") %>' />
                    </td>
                    <td>
                        <asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.StockItem.Item.Mark") %>' />
                    </td>
                    <td>
                        <asp:Label ID="Label4" runat="server" Text='<%#DataBinder.Eval(Container,"DataItem.StockItem.Count") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="txtQuantity" runat="server" Text='<%#DataBinder.Eval(Container,"DataItem.ItemCount") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="txtSellingPrice" runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.UnitPrice") %>' />
                    </td>
                    <td>
                    </td>
                </tr>
            </EditItemTemplate>
            <FooterTemplate>
                <tr align="center">
                    <td>
                        <asp:Label runat="server" Text="أجــمالي الفـاتـورة" Font-Bold="true" />
                    </td>
                    <td>
                        <asp:Label runat="server" ID="lblTotal" Font-Bold="true" />
                    </td>
                </tr>
                </table>
            </FooterTemplate>
        </asp:DataList>
    </p>
    <table align="right" width="100%">
        <tr>
            <td>
                <asp:Label ID="Label3" runat="server" Text="المـدفـوع" />
            </td>
            <td>
                <asp:TextBox runat="server" ID="txtPaid" OnTextChanged="txtPaid_TextChanged" AutoPostBack="true" Text="0.0" />
                <asp:RequiredFieldValidator runat="server" ControlToValidate="txtPaid" ErrorMessage="أدخـل المـدفـوع"
                    ValidationGroup="OrderVG" />
                <asp:RegularExpressionValidator runat="server" ControlToValidate="txtPaid" ErrorMessage="أرقام فقـط"
                    ValidationExpression="(\b[0-9]+\.([0-9]+\b)?|\.[0-9]+\b)" ID="vldexpPaid" />
                <%--<asp:RegularExpressionValidator runat="server" ValidationExpression = "^([0-9]{1,9})(\.[0-9]{1,4})$"
                    ErrorMessage="أرقــام فقـط" ValidationGroup="OrderVG" ControlToValidate="txtPaid"/>--%>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label runat="server" Text=": البـاقي" />
            </td>
            <td>
                <asp:Label runat="server" ID="lblChange" Text="0" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button runat="server" ID="btnTransfer" Text="تحـويـل البـاقي" ValidationGroup="OrderVG" />
            </td>
            <td>
                <asp:Button runat="server" ID="btnSubmit" Text="طبـاعـة الطلـب" OnClick="btnSubmit_Click"
                    ValidationGroup="OrderVG" />
            </td>
        </tr>
    </table>
</asp:Content>